package com.doit.demo01;

import java.util.Objects;

public class Person {
    private String name;
    private int age;

    @Override
    public int hashCode() {

        return Objects.hash(name, age);
    }

    @Override
    public boolean equals(Object obj) {
        if(this == obj)
            return true;
        if(obj==null)
            return false;
        if(!(obj instanceof Person))
            return false;
        if (this.age!=((Person) obj).age)
            return false;
        if(this.name!=((Person) obj).name)
            return false;

        return true;
    }

    @Override
    public String toString()
    {
        return name+age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Person() {

    }

    public Person(String name, int age) {

        this.name = name;
        this.age = age;
    }
}
